<?php
require 'db.php';

$id=$_REQUEST['id'];
$sql=mysql_query("select * from records where id='$id'")or die(mysql_error());
$data=mysql_fetch_assoc($sql);

?>
<html>
	<title>Ajax</title>
	<head>
		
		<style> 
tr:nth-child(odd)
{
background:#CCFFFF;
}
tr:nth-child(even)
{
background:#CCCCFF;
}
</style>
	</head>
	<body>
		
		
			<form name="ragister" id="edit" method="post" action="ed.php">
				<input type="hidden" name="id" value="<?=$_REQUEST['id'] ?>" />
			<table align="left" width="100%">
				<tr>
					<th colspan="2"><h3>Update Record For #id <?=$id ?></h3></th>
				</tr>
				<tr>
					<td>Name</td>
					<td><input type="text" name="name" id="name" value="<?=$data['name'] ?>" placeholder="Your Name" required/></td>
				</tr>
				<tr>
					<td>Email</td>
					<td><input type="email" name="email" id="email" value="<?=$data['email'] ?>" placeholder="Email" required/></td>
				</tr>
				<tr>
					<td>Mobile</td>
					<td><input type="tel" name="mobile" id="mobile" value="<?=$data['mobile'] ?>" placeholder="Mobile Number" required/></td>
				</tr>
				<tr>
					<td>Gender</td>
					<td><input type="radio" name="gender" id="gender" value="Male" />Male<input type="radio" name="gender" id="gender" value="Female" />Female</td>
				</tr>
				<tr>
					<td colspan="2">
					 <!-- Captcha Start
<img src="captcha/captcha.php" id="captcha" /><br/>
<a href="javascript:void(0)" onclick="    document.getElementById('captcha').src='captcha/captcha.php?'+Math.random();
    document.getElementById('captcha-form').focus();"
    id="change-image">Not readable? Change text.</a><br/><br/>
<input type="text" placeholder="Security Code" required name="secretword" id="captcha-form" /><br/>
Captcha End--> 

					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button  class="editbtn">Submit</button></td>
				</tr>
			</table>
			</form>
			
		
		<script type="text/javascript" src="js/jquery.js"></script>
		<script type="text/javascript" src="js/dl.js"></script>
		
		<script type="text/javascript">
        
        $(".editbtn").click( function() {
        	event.preventDefault();

	 	$.post( $("#edit").attr("action"),
	         $("#edit :input").serializeArray(),
			 function(info) {
			 $("#form").html(info);
			});
			    $("#edit").fadeOut('slow');
			    $("#ack").load("load.php");
		});
 

    </script>
	</body>
</html>